#include "CEventReceiver.h"


CEventReceiver::CEventReceiver(void)
{
	for (u32 i = 0; i < KEY_KEY_CODES_COUNT; ++i)
	{
		KeyIsDown[i] = false;
	}
}


CEventReceiver::~CEventReceiver(void)
{
}


bool CEventReceiver::OnEvent(const SEvent& event)
{
	if(event.EventType == EET_KEY_INPUT_EVENT)
	{
		KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
	}

	return false;
}


bool CEventReceiver::isKeyDown(EKEY_CODE keyCode) const
{
	return KeyIsDown[keyCode];
}


bool CEventReceiver::isAnyKeyDown() const
	{
		for(u32 i = 0; i < KEY_KEY_CODES_COUNT; ++i)
		{
			if(KeyIsDown[i])
			{
				return true;
			}
		}
		return false;
	}